package com.xauto.pioneer.appuser.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.xauto.pioneer.appuser.R;

/**
 * Created by lsx on 2018-03-28.
 */

public class ImageMessage extends LinearLayout {
    public final static int TEXT_TIME = 0;
    public final static int TEXT_ADR = 1;
    public final static int TEXT_DB = 2;
    private Context mContext;
    private TextView texttime;
    private TextView textadr;
    private TextView textdb;
    public ImageMessage(Context context) {
        super(context);
        mContext = context;
        initView();
    }
    public ImageMessage(Context context, AttributeSet attrs) {
        super(context, attrs);
        mContext = context;
        initView();
    }
    private void initView() {
        LayoutInflater inflater = LayoutInflater.from(mContext);
        View v = inflater.inflate(R.layout.layout_imageview, null);
        texttime = (TextView) v.findViewById(R.id.texttime);
        textadr = (TextView) v.findViewById(R.id.textadr);
        textdb = (TextView) v.findViewById(R.id.textdb);
        addView(v);
    }
    public void setText(int view, int text) {
        switch (view) {
            case TEXT_TIME:
                texttime.setText(text);
                break;
            case TEXT_ADR:
                textadr.setText(text);
                break;
            case TEXT_DB:
                textdb.setText(text);
                break;
        }
    }
}